<template>
	<view class="ass-page">
		<view class="content">
			<view class="box">
				<uv-steps :current="0" dot active-color="#4bc3a7">
					<uv-steps-item title="商家处理"></uv-steps-item>
					<uv-steps-item title="寄回商品"></uv-steps-item>
					<uv-steps-item title="商家收货"></uv-steps-item>
					<uv-steps-item title="退款成功"></uv-steps-item>
				</uv-steps>
				<view class="proof">
					<text class="status_tip">请尽快上传快递单号</text>
					<!-- 动态倒计时提示 -->
					<view class="countdown-section">
						<uv-count-down :time="remainingTime" format="HH:mm:ss" autoStart millisecond @change="onChange"
							@finish="onFinish">
							<view class="time">
								<text
									class="time__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;时</text>
								<text class="time__item">{{ timeData.minutes }}&nbsp;分</text>
								<text class="time__item">{{ timeData.seconds }}&nbsp;秒</text>
							</view>
						</uv-count-down>
						<text class="countdown-text">内填写快递单号</text>
					</view>
					<view class="tips">
						<view>商家地址：【贺琦售后部】球球</view>
						<view>15685985225</view>
						<view>湖北省武汉市黄陂区汉口北达到华中企业电子城1栋2楼售后仓</view>
					</view>
					<view class="evidence-tip">
						您需自行联系快递公司退回，请先垫付运费，保留<text class="cred">支付凭证</text>本单若为商家责任，审核通过后将补贴运费给您
					</view>
				</view>
			</view>
			<uv-gap height="10" bgColor="transparent" />
			<view class="box">
				<view class="pay_row">
					<text class="pay_lbl">退货运费</text>
					<text class="pay_val">￥<text class="price1">7.35</text></text>
				</view>
				<view class="pay_row">
					<text class="pay_lbl">退货物流：<text class="c333">邮政 1358964947862</text></text>
					<uv-icon name="arrow-right" size="12" color="#979797" />
				</view>
			</view>
			<uv-gap height="10" bgColor="transparent" />
			<view class="box">
				<view class="brand">
					<text class="f24 f600">协商记录</text>
					<view class="flex">
						<text class="f24 c97">您可添加留言/上传凭证</text>
						<uv-icon name="arrow-right" size="12" />
					</view>
				</view>
			</view>
			<uv-gap height="10" bgColor="transparent" />
			<view class="box">
				<view class="flex">
					<image :src="info.product_image" class="thumb" />
					<view class="flex-1 flex align-start justify-between">
						<view class="skus">
							<text class="pName">{{info.product_name}}</text>
							<uv-gap height="5" bgColor="transparent" v-if="info.spec_values" />
							<view class="tags" v-if="info.spec_values">{{info.spec_values}}</view>
						</view>
					</view>
				</view>
				<view class="order-info">
					<view class="orderNo">
						<view class="lbl_pay">订单编号：</view>{{info.order_no}}
					</view>
					<uv-button size="mini" type="primary" plain @click="copyOrderNo" style="margin-left: 10px;">
						复制
					</uv-button>
				</view>
				<view class="order-info1">
					<view class="lbl_pay">申请金额：</view>
					<view class="pay_info">￥{{info.refund_price}}</view>
				</view>
				<view class="order-info1">
					<view class="lbl_pay">退款原因：</view>
					<view class="pay_info">{{info.apply_for_reason_name}}</view>
				</view>
				<view class="order-info1">
					<view class="lbl_pay">收货状态：</view>
					<view class="pay_info">{{info.receipt_status==2?'已收到货':'未收到货'}}</view>
				</view>
				<view class="order-info1">
					<view class="lbl_pay">申请时间：</view>
					<view class="pay_info">{{info.create_time}}</view>
				</view>
			</view>
		</view>
		<view class="footer-btn">
			<view class="order-actions">
				<uv-button text="撤销售后" size="mini" @click="doSubmit"></uv-button>
				<uv-button text="我已退回，填写快递单号" color="#ff0000" @click="fillExpress"></uv-button>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		getGoodsAfterSalesDetail,
		cancelGoodsWithdraw
	} from '@/api'
	const remainingTime = ref(0)
	const timeData = ref('')
	const order_info_id = ref(50)
	const info = ref({})
	const onChange = (e) => {
		timeData.value = e
	}
	const fillExpress = () => {
		uni.navigateTo({
			url: '/pages-home/market/refund_form'
		})
	}
	onLoad(async (option) => {
		info.value = (await getGoodsAfterSalesDetail({
			order_info_id: order_info_id.value
		})).result
		let endDate = new Date()
		let now = new Date()
		endDate.setDate(now.getDate() + 1)
		remainingTime.value = endDate - now
	})
</script>

<style lang="scss" scoped>
	.ass-page {
		background-color: #f7f7f7;
		min-height: 100vh;
		padding-bottom: 80px;
	}

	.proof {
		padding: 20upx;
	}

	.status_tip {
		font-size: 32upx;
		font-weight: bold;
	}

	.time {
		// #ifndef APP-NVUE
		display: flex;
		// #endif
		flex-direction: row;
		align-items: center;

		&__item {
			color: red;
			font-size: 14px;
			text-align: center;
		}
	}

	.thumb {
		width: 100upx;
		height: 100upx;
		border-radius: 6upx;
		margin-right: 20upx;
		margin-bottom: 20upx;
	}

	.skus {
		.pName {
			font-size: 26upx;
			color: #333;
		}

		.tags {
			background: #F2F2F2;
			color: #333;
			display: inline-flex;
			border-radius: 6upx;
			font-size: 24upx;
			padding: 4upx 15upx;
		}
	}
	
	.cred {
		color: #ff0000;
	}

	.content {
		padding-top: 10px;

		.box {
			background-color: #fff;
			padding: 10px;

			.countdown-section {
				display: flex;
				align-items: center;
				margin-bottom: 20px;
			}

			.countdown-text {
				color: #999;
				font-size: 14px;
			}

			.evidence-tip {
				font-size: 26upx;
				color: #333;
			}

			.evidence-time {
				font-size: 24upx;
				color: #979797;
			}

			.pay_row {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 20upx 0;
				border-bottom: 1px solid #f0f0f0;
			}

			.pay_lbl {
				font-size: 28upx;
				color: #979797;
			}

			.pay_val {
				font-size: 28upx;
				color: #333;
			}

			.c333 {
				color: #333;
			}

			.brand {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.brand_name {
					display: flex;
					gap: 5px;
					align-items: center;
				}
			}

			.tips {
				background-color: #F0F0F0;
				border-radius: 16upx;
				padding: 20upx;
				font-size: 24upx;
				margin-top: 20upx;
				margin-bottom: 20upx;
			}

			.margin10 {
				margin-left: 10upx;
				margin-right: 10upx;
			}

			.tags {
				display: inline-flex;
			}

			.order-info {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin: 4px 0;
			}

			.order-info1 {
				display: flex;
				align-items: center;
				margin: 4px 0;
			}

			.orderNo {
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 24upx;
			}

			.lbl_pay {
				font-size: 24upx;
				color: #979797;
			}

			.pay_info {
				flex: 1;
				text-align: left;
				font-size: 24upx;
			}
		}
	}
	
	.footer-btn {
		position: fixed;
		bottom: 20px;
		left: 0;
		right: 0;
		padding: 0 15px;
	
		.order-actions {
			display: flex;
			justify-content: flex-end;
			align-items: center;
			padding: 15px;
			gap: 10px;
			background-color: #fff;
		}
	
	}
</style>